646
class Solution {
    public int findLongestChain(int[][] pairs) {
        Arrays.sort(pairs, (o1, o2)-{return o1[1]-o2[1];});
        int count = 1;
        int tmp = pairs[0][1];
        for (int i = 1; i  pairs.length; i++) {
            if (pairs[i][0]  tmp) {
                count++;
                tmp = pairs[i][1];
            }
        }
        return count;
    }
}